import sys
sys.path.insert(0, 'third_party')
sys.path.insert(0, '.')
from config import *
from common import *
from recipe_server import RecipeServer
from rs_web_handler import RSWebHandler
defaults_map = {
                'rpc_host'  : RECIPE_SERVER_RPC_HOST,
                'rpc_port'  : RECIPE_SERVER_RPC_PORT,
                'external_ip':RECIPE_SERVER_EXTERNAL_IP,
                'external_port':RECIPE_SERVER_EXTERNAL_PORT 
                }


def main():
    args = parse_opt(defaults_map)
    rs = RecipeServer(**args)
    web_server.set_root('recipe_server/static')
    web_server.listen(RECIPE_SERVER_HTTP_PORT)
    web_server.register(rs, RSWebHandler)    
    web_server.run()
if __name__ == '__main__':
    main()
    
    